package VectorApproach;

import java.util.ArrayList;

public class VQueue {
	
	protected ArrayList<VEle> listQEle = null;
	protected double angleMax = 0, distMax = 0;
	
	public VQueue(double angleMax, double distMax) {
		this.listQEle = new ArrayList<VEle>();
		this.angleMax = angleMax;
		this.distMax = distMax;
	}
	
	public void ACT001_push(TrajVector trv1, TrajVector trv2) {
		VEle newEle = new VEle(trv1, trv2);
		newEle.ACT001_countDist(this.angleMax, this.distMax);
		double newDist = newEle.GET001_dist();
		
		int indexQ = 0;
		boolean isInsert = false;
		
		if(newDist < 0) {
			isInsert = true;
		}
		
		while(!isInsert && indexQ < this.listQEle.size()) {
			if(newDist < this.listQEle.get(indexQ).GET001_dist()) {
				this.listQEle.add(indexQ, newEle);
				isInsert = true;
			}
			indexQ = indexQ + 1;
		}
		if(!isInsert) {
			this.listQEle.add(newEle);
		}
	}
	
	public VEle ACTOO2_pop() {
		VEle ele = this.listQEle.get(0);
		this.listQEle.remove(0);
		return ele;
	}
	
	public int GET001_queueSize() {
		return this.listQEle.size();
	}
	
	public static void main(String[] args) {
		
	}
}
